
from django.http import HttpResponse
from django.views.generic import View
from rest_framework.request import Request
"""
 DJango实现CBV
 注释csrf
"""
class NewsView(View):
    def get(self, request, *args, **kwargs):
        if 'pk' in kwargs:
            return HttpResponse('get请求,查询一条')
        return HttpResponse('get请求,查询多条')
    def post(self, request: Request, *args, **kwargs):
        return HttpResponse('post请求,添加')
    def put(self, request: Request,*args, **kwargs):
        return HttpResponse('put请求,修改')
    def delete(self, request: Request, *args, **kwargs):
        return HttpResponse('delete请求,删除')